package com.wj.facedetect.activity.alarm;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.wj.facedetect.R;
import com.wj.facedetect.activity.base.BaseActivity;

public class AlarmStatusActivity extends BaseActivity {
    private TextView tvLeft;
    private String status;
    private String alarmId;
    private View point1, point2, point3, point4, point5;
    private View line1, line2, line3, line4;
    private LinearLayout ll1, ll2, ll3, ll4;
    private RelativeLayout rl5;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_alarm_status);
        status = getIntent().getStringExtra("status");
        alarmId = getIntent().getStringExtra("warnId");
        initView();
    }

    private void initView() {
        tvLeft = (TextView) findViewById(R.id.tv_left);
        tvLeft.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        point1 = findViewById(R.id.point_one);
        point2 = findViewById(R.id.point_two);
        point3 = findViewById(R.id.point_three);
        point4 = findViewById(R.id.point_four);
        point5 = findViewById(R.id.point_five);
        line1 = findViewById(R.id.gray_line_one);
        line2 = findViewById(R.id.gray_line_two);
        line3 = findViewById(R.id.gray_line_three);
        line4 = findViewById(R.id.gray_line_four);
        ll1 = (LinearLayout) findViewById(R.id.ll_sdbj);
        ll2 = (LinearLayout) findViewById(R.id.ll_zprw);
        ll3 = (LinearLayout) findViewById(R.id.ll_qrrw);
        ll4 = (LinearLayout) findViewById(R.id.ll_rwjxz);
        rl5 = (RelativeLayout) findViewById(R.id.rl_rwwc);
        if (status != null) {
            if ("COMPLETION".equals(status)) {
                point1.setVisibility(View.VISIBLE);
                point2.setVisibility(View.VISIBLE);
                point3.setVisibility(View.VISIBLE);
                point4.setVisibility(View.VISIBLE);
                point5.setVisibility(View.VISIBLE);
                line1.setVisibility(View.VISIBLE);
                line2.setVisibility(View.VISIBLE);
                line3.setVisibility(View.VISIBLE);
                line4.setVisibility(View.VISIBLE);
                ll1.setVisibility(View.VISIBLE);
                ll2.setVisibility(View.VISIBLE);
                ll3.setVisibility(View.VISIBLE);
                ll4.setVisibility(View.VISIBLE);
                rl5.setVisibility(View.VISIBLE);
            } else if ("UNTREATED".equals(status)) {
                point1.setVisibility(View.VISIBLE);
                point2.setVisibility(View.GONE);
                point3.setVisibility(View.GONE);
                point4.setVisibility(View.GONE);
                point5.setVisibility(View.GONE);
                line1.setVisibility(View.GONE);
                line2.setVisibility(View.GONE);
                line3.setVisibility(View.GONE);
                line4.setVisibility(View.GONE);
                ll1.setVisibility(View.VISIBLE);
                ll2.setVisibility(View.GONE);
                ll3.setVisibility(View.GONE);
                ll4.setVisibility(View.GONE);
                rl5.setVisibility(View.GONE);
            } else if ("PROCESSING".equals(status)) {
                point1.setVisibility(View.VISIBLE);
                point2.setVisibility(View.VISIBLE);
                point3.setVisibility(View.VISIBLE);
                point4.setVisibility(View.VISIBLE);
                point5.setVisibility(View.GONE);
                line1.setVisibility(View.VISIBLE);
                line2.setVisibility(View.VISIBLE);
                line3.setVisibility(View.VISIBLE);
                line4.setVisibility(View.GONE);
                ll1.setVisibility(View.VISIBLE);
                ll2.setVisibility(View.VISIBLE);
                ll3.setVisibility(View.VISIBLE);
                ll4.setVisibility(View.VISIBLE);
                rl5.setVisibility(View.GONE);
            }
        }
    }

    public void detail(View view) {
        Intent intent = new Intent(this, TaskResultDetailActivity.class);
        intent.putExtra("warnId", alarmId);
        startActivity(intent);
    }

}
